<?php
echo $this->Html->css('form');
echo $this->Html->script('jquery.validate');
echo $this->Html->script('jquery.metadata');
?>
<div class="product-box">
<h3><a href=""><?php echo __('Đăng ký thành viên', true); ?></a></h3>
<p><?php echo __('If you already have an account with us, please login at the ', true); ?><a href="<?php echo Router::url(array('controller' => 'login', 'action' => 'index')); ?>"><?php echo __('login page', true);?>.</a></p>
<p style="padding-top: 10px;">
	<?php echo $this->Session->flash(); ?>
	<?php echo $form->create(array(
				'id'			=> 'formValidation',
				'action' 		=> 'index',
				'enctype' 		=> 'multipart/form-data',
				'class'         => 'form-horizontal',
				'autocomplete'	=> 'off'));
	?>
        <div class="control-group">
            <label class="control-label"><?php echo __('User name', true); ?>
            <span class="require">*</span></label>
            <div class="controls">
            <?php
		echo $form->input(
		'Member.username',
		array(
			'type'		=> 'text',
			'label'		=> false,
			'after'		=> ' <span class="hint">' . __('User name hint', true) . '</span>',
			'div'		=> false,
			'id'		=> 'Username',
			'size'		=> 40,
			'error'     => array(
					'username-rule1' => __('Username must be 1-30 characters, alphabets and numbers only.', true),
					'username-rule2' => __('Username is existed. Please enter again.', true)
				)
			)
			);
            ?>
            </div>
        </div>
		<div class="control-group">
            <label class="control-label"><?php echo __('Email', true); ?>
            <span class="require">*</span></label>
            <div class="controls">
            <?php
                echo $form->input(
					'Member.email',
					array(
							'type'		=> 'text',
							'label'		=> false,
							'after'		=> ' <span class="hint">' . __('Email hint', true) . '</span>',
							'div'		=> false,
							'size'		=> 50,
							'id'		=> 'Email',
							'error'     => array(
									'email-rule1' => __('Email address is not valid.', true),
									'email-rule2' => __('Email is existed. Please enter again.', true)
								)
					)
                );
            ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputEmail"><?php echo __('Password', true); ?>
            <span class="require">*</span></label>
            <div class="controls">
            <?php
                echo $form->input(
					'Member.ipasswd',
					array(
						'id'			=> 'passwd',
						'type'			=> 'password',
						'label'			=> false,
						'div'			=> false,
						'error'			=> array(
							'password-rule1' => __('Passwords must be between 8 and 15 characters long.', true),
							'password-rule2' => __('Two password is not same', true)
						)

					)
                );
            ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><?php echo __('Password again', true); ?>
            <span class="require">*</span></label>
            <div class="controls">
            <?php
                echo $form->input(
					'Member.passwd_confirm',
					array(
						'id'		=> 'passwd_confirm',
						'type'		=> 'password',
						'label'		=> false,
						'after'		=> ' <span class="hint">' . __('Password hint', true) . '</span>',
						'div'		=> false
						)
                );
            ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><?php echo __('Fullname', true); ?>
            <span class="require">*</span></label>
            <div class="controls">
            <?php
                echo $form->input(
				'Member.fullName',
				array(
					'type'			=> 'text',
					'label'			=> false,
					'div'			=> false,
					'size'			=> 50,
					'error'			=> array(__('Fullname must be 1-40 characters.', true))
				)
                );
            ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><?php echo __('Birthday', true); ?></label>
            <div class="controls">
            <?php
                echo $form->input(
				'Member.birthDay',
				array(
					'id'		=> 'birthday',
					'type'		=> 'text',
					'label'		=> false,
					'dateFormat' => 'DMY',
					'minYear'   => 1960,
					'maxYear'   => '2010',
					'after'		=> ' <span class="hint">' . __('Birthday hint', true) . '</span>',
					'div'		=> false,
					'error'		=> array(__('Enter a valid date', true))
					)
                );
            ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><?php echo __('Sex', true);  ?></label>
            <div class="controls">
            <?php
		echo $form->input(
			'Member.sex',
			array(
				'type'		=> 'radio',
				'label'		=> true,
				'div'		=> false,
				'legend'	=> false,
				'options'	=> array(
					'1'		=> __('Male', true),
					'0'		=> __('Female', true)
				),
				'value'		=> isset($this->data['Member']['Sex']) ? $this->data['Member']['Sex']: 1,
			)
		);
	?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><?php echo __('Address', true);  ?>
                <span class="require">*</span></label>
            <div class="controls">
            <?php
				echo $form->input(
				'Member.address',
				array(
					'type'		=> 'text',
					'label'		=> false,
					'div'		=> false,
					'size'		=> 70,
					'error'     => __('Address must be 1-100 characters', true)
				)
            );
            ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><?php echo __('Phone', true);  ?>
            </label>
            <div class="controls">
            <?php
				echo $form->input(
				'Member.phone',
				array(
					'id'		=> 'phone_number',
					'type'		=> 'text',
					'label'		=> false,
					'div'		=> false,
					'size'		=> 30
				)
            );
            ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><?php echo __('Mobile', true);  ?></label>
            <div class="controls">
            <?php
			echo $form->input(
                    'Member.mobile',
                    array(
                            'id'		=> 'mobile_number',
                            'type'		=> 'text',
                            'label'		=> false,
                            'div'		=> false,
                            'validate'  => 'vnMobile:true',
                            'size'		=> 40
                    )
                );
            ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><?php echo __('Security Code', true);  ?>
            <span class="require">*</span></label>
            <div class="controls">
            <?php
		echo $form->input(
			'Security.code',
			array(
				'type'		=> 'text',
				'label'		=> false,
				'div'		=> false,
				'size'		=> 6,
				'validate'	=> 'required:true',
				'value'		=> ''
			)
		);
            ?>
            <img src="<?php echo $captcha_image_url; ?>" id="captcha" alt="CAPTCHA Image" />
            <?php
                    echo "<br/>";
                    echo (!empty($error_captcha)) ? '<span class="status">'.$error_captcha.'</span>' : '';
            ?>
            </div>
        </div>
       <div class="submit">
           <label></label>
           <div class="controls">
		<?php echo $form->button(__('Send', true), array('class'=>'btn btn-danger','type'=>'submit', 'id'=>'regSubmit')); ?>
		<?php echo $form->button(__('Change', true), array('class'=>'btn btn-danger', 'type'=>'reset')); ?>

           </div>
       </div>
	<?php echo $form->end(); ?>
	<script type="text/javascript">
	$(document).ready(
		function() {
			$.metadata.setType("attr", "validate");
			$("form#formValidation").validate();
		}
	);
	</script>
</p>
</div>
